namespace PraceDyplomowe2.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddRolaToUserProfile : DbMigration
    {
        public override void Up()
        {
			Sql("INSERT INTO Rolas(Nazwa) VALUES('Promotor');");
			Sql("INSERT INTO Rolas(Nazwa) VALUES('Student');");
			Sql("INSERT INTO Rolas(Nazwa) VALUES('Dziekan');");

            AddColumn("dbo.UserProfiles", "Rola_RolaId", c => c.Int(nullable: false, defaultValue: 1));
            AddForeignKey("dbo.UserProfiles", "Rola_RolaId", "dbo.Rolas", "RolaId");
            CreateIndex("dbo.UserProfiles", "Rola_RolaId");

            DropColumn("dbo.UserProfiles", "RolaId");
        }
        
        public override void Down()
        {
            AddColumn("dbo.UserProfiles", "RolaId", c => c.Int(nullable: false, defaultValue: 0));

            DropIndex("dbo.UserProfiles", new[] { "Rola_RolaId" });
            DropForeignKey("dbo.UserProfiles", "Rola_RolaId", "dbo.Rolas");
            DropColumn("dbo.UserProfiles", "Rola_RolaId");

			Sql("DELETE FROM Rolas;");
        }
    }
}
